package com.hushan.elevator.service.impl;

import com.hushan.elevator.dao.DeviceDhcpConfigRepository;
import com.hushan.elevator.model.DeviceDhcpConfig;
import com.hushan.elevator.service.DeviceDhcpConfigService;
import jakarta.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeviceDhcpConfigServiceImpl implements DeviceDhcpConfigService {

    private final DeviceDhcpConfigRepository deviceDhcpConfigRepository;

    @Autowired
    public DeviceDhcpConfigServiceImpl(DeviceDhcpConfigRepository deviceDhcpConfigRepository) {
        this.deviceDhcpConfigRepository = deviceDhcpConfigRepository;
    }

    @Override
    public List<DeviceDhcpConfig> findAllDeviceDhcpConfigs() {
        return deviceDhcpConfigRepository.findAll();
    }

    @Override
    public DeviceDhcpConfig findDeviceDhcpConfigById(Integer id) {
        return deviceDhcpConfigRepository.findById(id).orElse(null);
    }

    @Override
    public List<DeviceDhcpConfig> findDeviceDhcpConfigsByDeviceNetworkConfigId(Integer deviceNetworkConfigId) {
        return deviceDhcpConfigRepository.findByDeviceNetworkConfigId(deviceNetworkConfigId);
    }

    @Override
    public List<DeviceDhcpConfig> findDeviceDhcpConfigsByIpAddress(String ipAddress) {
        return deviceDhcpConfigRepository.findByIpAddress(ipAddress);
    }

    @Override
    public List<DeviceDhcpConfig> findDeviceDhcpConfigsByIsDeleted(Boolean isDeleted) {
        return deviceDhcpConfigRepository.findByIsDeleted(isDeleted);
    }

    @Override
    public List<DeviceDhcpConfig> findDeviceDhcpConfigsByCreatedTimeBetween(LocalDateTime start, LocalDateTime end) {
        return deviceDhcpConfigRepository.findByCreatedTimeBetween(start, end);
    }

    @Override
    public List<DeviceDhcpConfig> findDeviceDhcpConfigsByUpdatedTimeBetween(LocalDateTime start, LocalDateTime end) {
        return deviceDhcpConfigRepository.findByUpdatedTimeBetween(start, end);
    }

    @Override
    @Transactional
    public void saveDeviceDhcpConfig(DeviceDhcpConfig deviceDhcpConfig) {
    }

    @Override
    public void deleteDeviceDhcpConfig(Integer id) {

    }
}